﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RibbonFactory.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="Hisaab.Windows.Client.RibbonFactory" /> type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Windows.RibbonWrapper
{
    using System;

    /// <summary>
    /// Defines the <seealso cref="RibbonFactory"/> type.
    /// </summary>
    public class RibbonFactory
    {
        /// <summary>
        /// Creates the ribbon.
        /// </summary>
        /// <param name="ribbon">The ribbon.</param>
        /// <returns>Ribbon object</returns>
        public static IRibbon CreateRibbon(object ribbon)
        {
            if (ribbon is Microsoft.Windows.Controls.Ribbon.Ribbon)
            {
                return new RibbonControlLibrary.Ribbon((Microsoft.Windows.Controls.Ribbon.Ribbon)ribbon);
            }
            
            if (ribbon is Fluent.Ribbon)
            {
                return new FluentLibrary.Ribbon((Fluent.Ribbon)ribbon);
            }

            throw new ApplicationException("Unrecognised ribbon framework encountered.");
        }
    }
}